UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iW6foxqjC/g7qjHKrK+9wQmB184HbudNykD486QE3vo='
WHERE
key_id = '66a9e872052deced43254b8bef799c48862ed8e9542b58b055419acf46241cbf'
AND (
token = 'iW6foxqjC/g7qjHKrK+9wQmB184HbudNykD486QE3vo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)