UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gwb+3xyLMvEhp+4fonWs7yHFWKWN9p+D3X1yFM8Q7cw=' 
WHERE 
  key_id = '8e5278080657d7e044f71251cf0bc0ae57971fd25e8af799da1aebb91fa588f6' 
  AND (
    token = 'gwb+3xyLMvEhp+4fonWs7yHFWKWN9p+D3X1yFM8Q7cw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052