UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NsBHPKDa9Q0Hbba4068RSCS6vu1iUp7dGg5yV7g8oxk=' 
WHERE 
  key_id = 'e982633231371f82f03f5d7fd856c1ce542b9bb27810687439fdadcc5f966bda' 
  AND (
    token = 'NsBHPKDa9Q0Hbba4068RSCS6vu1iUp7dGg5yV7g8oxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027