UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2n9SS8kRydWLLCheKgtMGzBBkkzp+i6lRVC2DZ/h+zw=' 
WHERE 
  key_id = '5f98d0cec93ca09654f63ffd3a9a7813de9901340a2e1e91fb37a1247e723bea' 
  AND (
    token = '2n9SS8kRydWLLCheKgtMGzBBkkzp+i6lRVC2DZ/h+zw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047