UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QYrFItkESKn7OGv1Eh24VaGBW2kRD08tIQ0Pq+qa+TE=' 
WHERE 
  key_id = 'fb76349dc97e8ac0364b25a318912a1db6a4bf09766714ce4f88b557477acf4a' 
  AND (
    token = 'QYrFItkESKn7OGv1Eh24VaGBW2kRD08tIQ0Pq+qa+TE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060