UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lCrHE2mZj8AqMDDVc4vSb5ne88k8oOW7ZHndtt1VSZU=' 
WHERE 
  key_id = '8ec122ff97ae04978a995071cfa6ff23898a21b4f7cbe6c490405531af9b5ec9' 
  AND (
    token = 'lCrHE2mZj8AqMDDVc4vSb5ne88k8oOW7ZHndtt1VSZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037