UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yWHM4socaEyigyme9F+XFKcKydgBGIm9+pLJeKEyRhA=' 
WHERE 
  key_id = '354fb42ee6e5d160cd228fce2c4bf02bf17af768a2635620dbe01e36d7f9c7b6' 
  AND (
    token = 'yWHM4socaEyigyme9F+XFKcKydgBGIm9+pLJeKEyRhA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047