UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E5CqELGj20qTkOE/i5xGHP5ir8etBKSvPdaXjjWX8rg=' 
WHERE 
  key_id = 'ca04010d0e7103968843023a0a0003fcf833390c75790b89f9779175c9af8da4' 
  AND (
    token = 'E5CqELGj20qTkOE/i5xGHP5ir8etBKSvPdaXjjWX8rg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035