UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZfTP0pvdK7kiS8DHINAUGm95PiA31hrsGXSgqVrMrI8='
WHERE
key_id = '00c5d58b9b3058c3ce9bfec18093a6d5e6dcf6c780b7114e344de21f3968315c'
AND (
token = 'ZfTP0pvdK7kiS8DHINAUGm95PiA31hrsGXSgqVrMrI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)