UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CU+D18VtUStzTPITKDYzTFiPPWLbp75f2tQJPfvSWn0=' 
WHERE 
  key_id = '7e9298caca963d00f88f375e11d826852b584ffef7c693207d89b928be023350' 
  AND (
    token = 'CU+D18VtUStzTPITKDYzTFiPPWLbp75f2tQJPfvSWn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031