UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sb30ZKbtjjjhvCo2eo12wx5bm990bONs0NCRaG3plhE=' 
WHERE 
  key_id = '3c7cc734e864bd534f2f32717c95ea12bb6018af17f1039664e5ca59b24bb4fb' 
  AND (
    token = 'Sb30ZKbtjjjhvCo2eo12wx5bm990bONs0NCRaG3plhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028