UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c4KqxP6sWjtAKoeJtmwe9Iyhfh2yyQHRqs1z7fuezw4=' 
WHERE 
  key_id = '717d65202af8de1765c191dd0c34cd40b7e784ae3bc16a65c68ae0906f3b1ed6' 
  AND (
    token = 'c4KqxP6sWjtAKoeJtmwe9Iyhfh2yyQHRqs1z7fuezw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047