UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xwPEfsFzY27OPjafq87vjt6w/AfCJWBPMdqJROhnLI0=' 
WHERE 
  key_id = 'b85ce9927c05bc2f5c7e3eac154ac7a8a51aa4bfe83923239f023a320397f2fb' 
  AND (
    token = 'xwPEfsFzY27OPjafq87vjt6w/AfCJWBPMdqJROhnLI0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058