UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MyUeTuTO0R40YN99xsCJsgIpejQp2e8Pp9xpG9OWkCY=' 
WHERE 
  key_id = '40df827667e784b51bab59e65ce426bd76418c1ee9dd536ce2bfedf5cb6a4c22' 
  AND (
    token = 'MyUeTuTO0R40YN99xsCJsgIpejQp2e8Pp9xpG9OWkCY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038