UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hUT42IoqxkVfGhkF1lw6okxGHK47V6G9gbNhNxj3y/0='
WHERE
key_id = 'cf51470d7111ff07412e1b76a7ea321c6dc037c70d0440c35864e590828cf98d'
AND (
token = 'hUT42IoqxkVfGhkF1lw6okxGHK47V6G9gbNhNxj3y/0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)