UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cufkRrNggs39/W/1OxUI0DtZDsyhfAY8MT22hs4BAN4=' 
WHERE 
  key_id = '56d9d4844ced6690100b934a06889e2ee0aa41d727716abccf464d122e4b31a4' 
  AND (
    token = 'cufkRrNggs39/W/1OxUI0DtZDsyhfAY8MT22hs4BAN4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068