UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'taTzm3kKtzbpRaq7Ml54cvqnZMcg3okmlB5iht6MOEI='
WHERE
key_id = 'f5ce2d5f4b4ecb0e32f80134dc75df995293cb2ad4cd3c7b6f6ff8099bfd6472'
AND (
token = 'taTzm3kKtzbpRaq7Ml54cvqnZMcg3okmlB5iht6MOEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)