UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vEadUG2FkLJnRyTbLiHDgljl7unyaVzZ7EN7F89uMu8=' 
WHERE 
  key_id = 'cbe71c28f944f4c6a98160a70e80fca54daa65c094be89987fde217d874272f0' 
  AND (
    token = 'vEadUG2FkLJnRyTbLiHDgljl7unyaVzZ7EN7F89uMu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047