UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SL1HaRi2SI0fjSwP4V9NL+vTQaZ7oKB4NZ1+L6AT/1Y='
WHERE
key_id = 'f4042c21083635817fefd92bbf2f58335e5960513097e27c197fcf662cf56a5e'
AND (
token = 'SL1HaRi2SI0fjSwP4V9NL+vTQaZ7oKB4NZ1+L6AT/1Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)