UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uNKjj2+nPQCR+nJGtNggTeceuSW9BVV8+dkSpbTzLRA=' 
WHERE 
  key_id = '9135c20316ed90cda0a1612e33463ba43a4b971252e0e50421ceb8dc14f91fb6' 
  AND (
    token = 'uNKjj2+nPQCR+nJGtNggTeceuSW9BVV8+dkSpbTzLRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041