UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gq50kFTJDqW59oKqiTpzAFJe1om4qZiRz3OcqhdMj/M='
WHERE
key_id = 'fb8ccf91c35b7fa059f6ace5b6f67a739257ec8d35d07a9c8d8b7d90ebf2200a'
AND (
token = 'gq50kFTJDqW59oKqiTpzAFJe1om4qZiRz3OcqhdMj/M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)