UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3tZHTdwYhivC7+aYPe0TrCvmRUxhevy7tezjgpT4hbU='
WHERE
key_id = 'ffdf5679f927d9eb3a30d8095c703d62d749d64181b4966f4c5c422d3b002cb2'
AND (
token = '3tZHTdwYhivC7+aYPe0TrCvmRUxhevy7tezjgpT4hbU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)