UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZPiLWBedUD0OXicPlLd/WuX87u3+5bKK5zC1oC8inws=' 
WHERE 
  key_id = '2418df3c3080b2502657d74915f666184822e6d954d3fdf51d09caca4bddbfc2' 
  AND (
    token = 'ZPiLWBedUD0OXicPlLd/WuX87u3+5bKK5zC1oC8inws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055