UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QKbx78If3+y+C1EJvPn9EUZJ+DXmL3KocvrWlE1yWBU='
WHERE
key_id = '319b1e4c168221a65cd5f41c636a7290ddb11e6361f280b644c39cafe1a94bbd'
AND (
token = 'QKbx78If3+y+C1EJvPn9EUZJ+DXmL3KocvrWlE1yWBU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)