UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e/MvASRp4y0wIcDApidEdCH/PCZ23M4m2d2aIupDLbc=' 
WHERE 
  key_id = '4526e40dd79701de8e9c13e1f8f7dfb482044365f97cd80d348b52a23f5a3ef1' 
  AND (
    token = 'e/MvASRp4y0wIcDApidEdCH/PCZ23M4m2d2aIupDLbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026