UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '48XuTWGfxHWrKnK30jD3cn5ZM9jOIxXEee2vO9v76xA=' 
WHERE 
  key_id = 'c40e75f2f841629adbd1e4e42dee700507ced8e6f5f39cfcfde445b498d15af8' 
  AND (
    token = '48XuTWGfxHWrKnK30jD3cn5ZM9jOIxXEee2vO9v76xA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026