UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XYJlcxZ/T6jENxNugb3HVCHvNG9UfAOOSOIgbKKkLm8='
WHERE
key_id = 'ef8231569dc29506b35bccd7658b1bafa9da74a2c339581e5cd96ccaa4782927'
AND (
token = 'XYJlcxZ/T6jENxNugb3HVCHvNG9UfAOOSOIgbKKkLm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)