UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+IffmPflXuTO1UYj9LFlGlMx7xqwp7U5bAfHNxItcMA='
WHERE
key_id = '59adf233223979cd82ac8f8bc354e3e6ca6e8f2fbea12be1c922fef294d2ed65'
AND (
token = '+IffmPflXuTO1UYj9LFlGlMx7xqwp7U5bAfHNxItcMA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)