UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uri4WYw1ios1cp5WPcFnFoObw88tOnG2RTjnSmmRMfU=' 
WHERE 
  key_id = '9aef36793320dfc743a234f5339ceb9ef03460f2082f49a9b62158a7f600be67' 
  AND (
    token = 'Uri4WYw1ios1cp5WPcFnFoObw88tOnG2RTjnSmmRMfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028