UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rYOrPc+K9CCif4RN44zn56Y6KVKqn8gLtAjNNNpCaf8='
WHERE
key_id = '9f7855771332295be6322f064046e37fb5ee72a7ba63f10cd27d36bd019ba350'
AND (
token = 'rYOrPc+K9CCif4RN44zn56Y6KVKqn8gLtAjNNNpCaf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)