UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7cHedWeIamhhmlxc8e3BGj3HyZGEzuMEVVMImf2b/Q4='
WHERE
key_id = 'f0a1e3818069305ee2ab20f2d4b72e6f5bb515ee6a07f3e74e8a7f4f9307babc'
AND (
token = '7cHedWeIamhhmlxc8e3BGj3HyZGEzuMEVVMImf2b/Q4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)