UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cI7S2mshGVbtlHGIRwS8phf/pHRSJRXllLy9zK1qur0=' 
WHERE 
  key_id = 'aea3725ed4c9b668f4c35be87b3f5373eac27b55fd72a98d2d0a83d5d6db9f8e' 
  AND (
    token = 'cI7S2mshGVbtlHGIRwS8phf/pHRSJRXllLy9zK1qur0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076