UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XfHo3y6hX1VZoxwYsb8b7EBQe9l5uePVfgS7tjbROL4='
WHERE
key_id = '7be02d1acf83f14010eb062ed78cb8c3b36aa642a13182c427a6ebc3476dd201'
AND (
token = 'XfHo3y6hX1VZoxwYsb8b7EBQe9l5uePVfgS7tjbROL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)