UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n+PDV9ayLY4XGfvbgD3oTAj35zvUPQx8SMoyOL4tQ48=' 
WHERE 
  key_id = 'e3ef2e432296142654998637e14e547ab7e6aa7dcfec64092c005b8952cafd97' 
  AND (
    token = 'n+PDV9ayLY4XGfvbgD3oTAj35zvUPQx8SMoyOL4tQ48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028