UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cHcFlAmPQRw8XkEBnQhr677KCswTECJUYHM2SXW+dwk='
WHERE
key_id = 'b603260809a4d389f60e5cb92507dde4bf3998b95514bda7ebde0cef335d36e3'
AND (
token = 'cHcFlAmPQRw8XkEBnQhr677KCswTECJUYHM2SXW+dwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)